<?php
	//session_start();
	include_once("conn.php");
	
	$tid = $_GET["tid"];
	$board_name = $_GET["board"];

	$sql = "select * from bbs_topic where t_id = '".$tid."'";
	$result = mysql_query($sql);
	$q_result = mysql_fetch_array($result);

	//接下来，取出浏览帖子需要的 标题、内容、作者、发表时间、其他如回复数，点击数稍后实现。。

	$post_board = $board_name;	//发表版面
	$post_name = $q_result["t_topic"];
	$post_content = $q_result["t_content"];
	$post_author = $q_result["t_author"];
	$post_time = $q_result["t_time"];

	//接下来是取读评论的代码

	$sql = "select * from bbs_reply where r_tid = '".$tid."'";
	$result = mysql_query($sql);
	/*
	$q_result = mysql_fetch_array($result);

	//取出浏览评论界面需要的：回帖者名字，回帖时间，回帖内容,回帖信区

	$comment_user = $q_result["r_u_name"];
	$comment_time = $q_result["r_time"];
	$comment_content = $q_result["r_content"];
	$comment_session = $q_result["r_s_name"];
	*/

?>
<html>
<head>
<meta charset="utf-8" />
<link rel = "stylesheet" href = "browse.css" type = "text/css" />
<link rel = "stylesheet" href = "sidebar.css" type = "text/css" />
<script src = "jquery-1.7.1.js"></script>
<script>
$(function(){
	$("#div_hidden").click(function(){
		$("#div_reply").slideToggle();
	});
	$("#a_reply").click(function(){
		$("#div_reply").slideToggle();
		$("#reply_content").focus();
	});
	$("#reply_reset").click(function(){
		$("#reply_content").focus();
	});

});
</script>

</head>
<body>
<?php include_once("sidebar.php"); ?>
<p id = 'bt'><a href = "index.php">小树林BBS站</a><a id="a_banmian" href = "page.php?board=<?php echo $post_board; ?>"><?php echo $post_board; ?></a></p>
<hr>

<table name = "post_main" class = "post_main" id = "post_main" >
	<tr>
		<td>发帖人:<a href = "#"><?php echo $post_author; ?></a>
		&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp版面:<?php echo $post_board; ?></td>
		<td id = "level">0</td>
	</tr>

	<tr>
		<td>标&nbsp&nbsp题:<?php echo $post_name; ?></td>
	</tr>
	<tr>
		<td>发帖时间:<?php echo $post_time; ?></td>
	</tr>
	
	<tr>
		<td id="neirong"><?php echo $post_content; ?></td>
	</tr>
	<tr>
		<td>--</td>
	</tr>
	<tr>
		<td>※&nbsp小树林BBS站，版权所有&nbsp请尊重原创&nbsp※</td>
	</tr>
</table>

<?php
	while($q_result = mysql_fetch_array($result))
	{
		$comment_user = $q_result["r_u_name"];
		$comment_time = $q_result["r_time"];
		$comment_content = $q_result["r_content"];
		$comment_session = $q_result["r_s_name"];
?>

<table class = "reply_table">
	<tr>
		<td>回帖人:<a href = "#"><?php echo $comment_user; ?></a>
		&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp版面:<?php echo $comment_session; ?></td>
		<td>0</td>
	</tr>

	<tr>
		<td>标&nbsp&nbsp题:<?php echo $post_name; ?></td>
	</tr>
	<tr>
		<td>发帖时间:<?php echo $comment_time; ?></td>
	</tr>
	
	<tr>
		<td class = "rp_neirong"><?php echo $comment_content; ?></td>
	</tr>
	<tr>
		<td>--</td>
	</tr>
	<tr>
		<td>※&nbsp小树林BBS站，版权所有&nbsp请尊重原创&nbsp※</td>
	</tr>
</table>



<?php
	}
?>

<table name = "tb_reply" id = "tb_reply" class = "tb_reply" >
	<tr>
		<td id = "td_reply"><a href = "#" id = "a_reply" name = "a_reply" >发表回帖</a></td>
		<td><a href = "page.php?board=<?php echo $post_board; ?>"> >>返回本版</a></td>
	</tr>
</table>

<div class = "div_reply" id = "div_reply" name = "div_reply">
	<form action = "reply_process.php" method = "post" id = "reply_fm">
		<tr>
			<td><textarea name = "reply_content" id = "reply_content" rows = "6" cols = "75"></textarea></td>
			<input type = "hidden" value = "<?php echo $tid; ?>" id = "r_tid" name = "r_tid">
			<input type = "hidden" value = "<?php echo $post_board; ?>" id = "r_board_name" name = "r_board_name">
			<input type = "hidden" value = "<?php echo $post_name; ?>" name = "r_t_name" id = "r_t_name" >
		</tr>

		<tr>
			<td><input type = "submit" value = "回帖" name = "submit_reply" ></td>
			<td><input type = "reset" value = "删掉重写" id = "reply_reset"></td>
			<td><input type = "button" value = "点我收起！" id = "div_hidden" name = "div_hidden" ></td>
		</tr>
	</form>
</div>

</body>
</html>